﻿<?php
// session_start();
	
	if (!isset($_SESSION["taikhoan"]))
	{
		header("Location: ad-dangnhap.php");
	}
	 include "connect.php"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<!-- them moi khoa-->
<form name="f" method="post" action="" onsubmit="">
			<table width="400" align="center" border="0" style="border:1px solid #0066FF" cellspacing="0">
						
					  <tr> 
							<td height="30" colspan="2" align="center" bordercolor="#FFFFFF" background="image/bg_header.gif">
								<span style="font-size:24px; color:#FFFFFF; font-weight:bold;">Thêm Khoa mới</span></td>
					  </tr>
					  
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="15" width="200" colspan="2"></td>
						 
					  </tr>
						
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px" width="200">Mã Khoa:</td>
						 <td align="left"><input type="text" name="makhoa" /></td>
					  </tr>
					  
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px">Tên Khoa:</td>
						 <td align="left"><input type="text" name="tenkhoa" /></td>
					  </tr>
					  
					  
					   <tr bordercolor="#FFFFFF" align="left"> 
						  <td  height="30" colspan="2" class="style4">Tài Khoản:</td>
					  </tr>
					  
					   <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px">Mật Khẩu:</td>
						 <td align="left"><input type="password" name="mkk" /></td>
					  </tr>
					  
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="15"  colspan="2"></td>
						 
					  </tr>
					  
					  <tr bordercolor="#FFFFFF">
						  <td  align="right" height="30"><input type="submit" value="Lưu Lại" name="luu" /></td>
						  <td align="center"><input type="reset" value="Làm Lại" name="huy" /></td>
					 </tr>
					
			</table>
</form>
<?php
           if(isset($_POST["luu"]))
				{
				          $ms = $_POST["makhoa"];
				          $ten = $_POST["tenkhoa"];
						  $mk = $_POST["mkk"];
						  $mkmh = md5($mk);
						  
						  $kq = mysql_query("insert into `khoa` values('$ms','$ten','$ms' )");
						  $kq1 = mysql_query("insert into `tai khoan` values('$ms','$mkmh','CNK' )");
						  echo"<script type='text/javascript'>alert('Them Thanh Cong')</script>";
		                  echo'<meta http-equiv="refresh" content="0;URL=ad-trangchu.php?nav=ttkhoa">';
						  
				}
 ?>		
</body>
</html>
